<template>
    <div class="nav">
        <div v-for="item of nav" :key="item.id" @click="MerchantsJump(item.query)">
            <img :src="item.imgUrl" alt="">
            <p>{{item.name}}</p>
        </div>
    </div>
</template>

<script>
    import {computed} from "vue";

    export default {
        name: "NavCom",
        data() {
            return {
                nav: computed(() => this.$store.state.nav)
            }
        },
        methods: {
            MerchantsJump(query) {
                this.$router.push(`/merchants-view?query=${query}`)
            }
        }
    }
</script>

<style scoped>
    .nav {
        width: 100%;
        /*background: lightcoral;*/
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        /*    wrap换行，nowrap默认值不换行，wrap-reverse换行颠倒位置*/
    }

    .nav div {
        width: 18vw;
        height: 20vw;
        /*background: lightgreen;*/
        text-align: center;
    }

    .nav img {
        width: 70%
    }

    .nav p {
        padding-top: 0.06rem;
        font-size: .11rem;
        color: #222426;
        line-height: .11rem;
        text-align: center;
        white-space: nowrap;
    }
</style>